import { Request } from "./request";
//开始页面
module.exports.Banner = () => Request({
  url: "/banner/list",
  method: "get"
})

//
//  首页区域
//
// 公告消息
module.exports.homeNotice = () => Request({
  url: "/notice/list",
  method: "get"
})
// 九宫格区域
module.exports.homeCategory = () => Request({
  url: "/shop/goods/category/all",
  method: "get"
})
// 所有商品
module.exports.allGoods = () => Request({
  url: "/shop/goods/list",
  method: "post"
})



//
// 分类
//
//Category
module.exports.categoryId = (id) => Request({
  url: `/shop/goods/list?categoryId=${id}`,
  method: "get"
})
//加入购物车
// shopping-cart/add
module.exports.addCart = (data) => Request({
  url: `/shopping-cart/add`,
  method: "post",
  data
})
//商品详情
module.exports.goodsDetail = (id) => Request({
  url: `/shop/goods/detail?id=${id}`,
  method: "get"
})
//收藏商品
module.exports.goodsFav = (data) => Request({
  url: `/shop/goods/fav/add`,
  method: "post",
  data
})
//查看商品是否已收藏
module.exports.checkGoodsFav = (data) => Request({
  url: `/shop/goods/fav/check`,
  method: "get",
  data
})
//删除收藏的商品
module.exports.deleteFav = (data) => Request({
  url: `/shop/goods/fav/delete`,
  method: "post",
  data
})
//获取收藏列表
module.exports.favList = (data) => Request({
  url: `/shop/goods/fav/list`,
  method: "post",
  data
})


//
//购物车
//
//获取购物车数据
module.exports.cartInfo = (token) => Request({
  url: `/shopping-cart/info?token=${token}`,
  method: "get"
})
//修改商品数量
// shopping-cart/modifyNumber
module.exports.modifyNumber = (data) => Request({
  url: `/shopping-cart/modifyNumber`,
  method: "post",
  data
})
//删除单个商品
// shopping-cart/modifyNumber
module.exports.remove = (data) => Request({
  url: `/shopping-cart/remove`,
  method: "post",
  data
})




// 登陆
module.exports.login = (data) => Request({
  url: `/user/wxapp/login?code=${data}`,
  method: "get",
  data
})

// 注册
module.exports.zhuce = (obj) => Request({
  url: `/user/wxapp/register/simple?code=${obj}`,
  method: "post"
})
// 用户资产
module.exports.amount = (token) => Request({
  url: `/user/amount?token=${token}`,
  method: "get"
})


//获取所有的收获地址
module.exports.allAddress = (token) => Request({
  url: `/user/shipping-address/list?token=${token}`,
  method: "get"
})
//添加收获地址
module.exports.addAddress = (data) => Request({
  url: `/user/shipping-address/add`,
  method: "post",
  data
})
//修改收获地址
module.exports.updateAddress = (data) => Request({
  url: `/user/shipping-address/update`,
  method: "post",
  data
})
//删除收获地址
module.exports.deleteAddress = (data) => Request({
  url: `/user/shipping-address/delete`,
  method: "post",
  data
})